home *** CD-ROM | disk | FTP | other *** search
- '*****************************************************************************
- '
- ' PullDown.Bas
- '
- '*****************************************************************************
-
- 'Copyright (c) 1988 Marcel Madonna
-
- 'PULLDOWN.BAS shows the use of pulldown menus
- ' with QBWARE.
- '*****************************************************************************
-
-
- OPTION BASE 1
-
-
- ' Dim arrays for QB Syntax check only - we REDIM them later
-
-
- x% = 1
- DIM Text$(x%), MenuText$(x%), Location%(x%, 2), TColors%(x%, 2), TLength%(x%)
- DIM TblData$(x%), TblSlct%(x%), SText$(x%)
-
-
- ' Set up housekeeping for window drivers
-
- DIM MenuList$(6, 6)
- StackSize% = 20000
- DIM WinStack%(StackSize%) 'Window stack - we keep screen images
- 'and other info here
- DIM WinFrame%(20, 5) 'Define maximum number of windows as 20
- 'we keep specific window data here
- GOSUB A1000.Window.Hskp
-
-
- ' Now let's display the pulldown menu
-
- MenuNum% = 0 'Means display only the top line
- 'and return immediately to this program
-
- GOSUB Display.PullDown
-
-
- ' Let's wait for some input and then route it the the proper routine
-
- WaitForInput:
-
- LOCATE , , 0 'Turn the cursor off
- CALL InpWin(WinStack%(), Input.Char$, 0)
- MenuNum% = INSTR(KeyFlds$, Input.Char$)
- IF MenuNum% = 0 OR LEN(Input.Char$) <> 2 THEN
- GOTO WaitForInput
- ELSE
- MenuNum% = INT((MenuNum% / 2) + 1)
- GOTO Display.PullDown
- END IF
- LOCATE , , 1 'Turn the cursor back on
-
-
- Display.PullDown:
-
- Tr% = 1: Fg% = 0: Bg% = 3
-
- 'This call displays the pulldown menu
- CALL PullDown(WinStack%(), WinFrame%(), WinPoint%, MenuList$(), MenuNum%, Tr%, Fg%, Bg%, MFg%, MBg%, RtnMnu%, RtnItm%)
-
- 'This next statement routes the request the the proper routine
- 'If MenuNum% was 0 on input to pulldown, then RtnMnu% = 0 and we will drop
- ' right thru the ON statement here
- ON RtnMnu% GOSUB Menu1, Menu2, Menu3, Menu4, Menu5, Menu6
-
- GOTO WaitForInput
-
- Menu1:
- ON RtnItm% GOTO Menu11, Menu12, Menu13, Menu14, Menu15
-
- Menu2:
- ON RtnItm% GOTO Menu21, Menu22, Menu23, Menu24, Menu25
-
- Menu3:
- ON RtnItm% GOTO Menu31, Menu32, Menu33, Menu34, Menu35
-
- Menu4:
- ON RtnItm% GOTO Menu41, Menu42, Menu43, Menu44, Menu45
-
- Menu5:
- ON RtnItm% GOTO Menu51, Menu52, Menu53, Menu54, Menu55
-
- Menu6:
- ON RtnItm% GOTO Menu61, Menu62, Menu63, Menu64, Menu65
-
- Menu11:
- Menu12:
- Menu13:
- Menu14:
- Menu15:
-
- Menu21:
- Menu22:
- Menu23:
- Menu24:
- Menu25:
-
- Menu31:
- Menu32:
- Menu33:
- Menu34:
- Menu35:
-
- Menu41:
- Menu42:
- Menu43:
- Menu44:
- Menu45:
-
- Menu51:
- Menu52:
- Menu53:
- Menu54:
- Menu55:
-
- Menu61:
- Menu62:
- Menu63:
- Menu64:
- Menu65:
-
- CLS
- PRINT "You selected item" + STR$(RtnItm%)
- PRINT "From menu" + STR$(RtnMnu%)
- END
-
-
- A1000.Window.Hskp:
-
- ' Load the menu itwms
-
- RESTORE MainMenu.Data
- FOR x% = 1 TO UBOUND(MenuList$, 2)
- FOR y% = 1 TO UBOUND(MenuList$, 1)
- READ MenuList$(y%, x%)
- NEXT y%
- NEXT x%
-
- 'Set up the posible keys that can be returned
-
- Alt.A$ = CHR$(0) + CHR$(30) 'Alt-A keycode
- Alt.B$ = CHR$(0) + CHR$(48) 'Alt-B keycode
- Alt.C$ = CHR$(0) + CHR$(46) 'Alt-C keycode
- Alt.D$ = CHR$(0) + CHR$(32) 'Alt-D keycode
- Alt.E$ = CHR$(0) + CHR$(18) 'Alt-E keycode
- Alt.F$ = CHR$(0) + CHR$(33) 'Alt-F keycode
-
- KeyFlds$ = Alt.A$ + Alt.B$ + Alt.C$ + Alt.D$ + Alt.E$ + Alt.F$
-
- Text$ = STRING$(2000, CHR$(176))
- Row% = 1: Col% = 1: Fg% = 0: Bg% = 1
- CALL Putline(Snow%, Text$, Row%, Col%, Fg%, Bg%)
- Text$ = ""
-
- MFg% = 15: MBg% = 0
- MaxWin% = 20
- ExitKeys$ = CHR$(27)
- TabLen% = 8
- SBar% = 1: SRow% = 25: SFg% = 15: Sbg% = 1
-
- CALL InitWin(WinStack%(), WinFrame%(), WinPoint%, MaxWin%, ExitKeys$, TabLen%, SBar%, SRow%, SFg%, Sbg%, Snow%)
- RETURN
-
- ' These are the menu choices. The first item appears on the bar and the items
- ' below appear on the pulldown menu. Each column must have EXACTLY the same
- ' number of entries - even if some are null
-
- MainMenu.Data:
- DATA "AMenu","BMenu","CMenu","DMenu","EMenu","FMenu"
- DATA "AItem","AItem","AItem","AItem","AItem","AItem"
- DATA "BItem","BItem","BItem","BItem","BItem","BItem"
- DATA "CItem","CItem","CItem","CItem","CItem","CItem"
- DATA "DItem","DItem","DItem","DItem","DItem","DItem"
- DATA "EItem","EItem","EItem","EItem","EItem","EItem"
-
- END
-
-